window: Set the type hint when it changes, not just on map()
authorBenjamin Otte <otte@redhat.com>
Sun, 19 Jul 2015 02:44:17 +0000 (04:44 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 19 Jul 2015 02:45:25 +0000 (04:45 +0200)
There is no reason to wait until map() to reset a type hint on the GDK
window. Just set it when it changes.

gtk/gtkwindow.c

index 067d75542247519c4d82576f9146a4620b618450..c208f58d72a29d2e4128bf114df23185b6b81cb9 100644 (file)
@@ -219,7 +219,6 @@ struct _GtkWindowPrivate
   guint    focus_visible             : 1;
   guint    modal                     : 1;
   guint    position                  : 3;
-  guint    reset_type_hint           : 1;
   guint    resizable                 : 1;
   guint    skips_pager               : 1;
   guint    skips_taskbar             : 1;
@@ -3501,6 +3500,7 @@ gtk_window_set_type_hint (GtkWindow           *window,
                          GdkWindowTypeHint    hint)
 {
   GtkWindowPrivate *priv;
+  GdkWindow *gdk_window;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
 
@@ -3511,10 +3511,9 @@ gtk_window_set_type_hint (GtkWindow           *window,
 
   priv->type_hint = hint;
 
-  if (gtk_widget_get_mapped (GTK_WIDGET (window)))
-    gdk_window_set_type_hint (gtk_widget_get_window (GTK_WIDGET (window)), hint);
-  else
-    priv->reset_type_hint = TRUE;
+  gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+  if (gdk_window)
+    gdk_window_set_type_hint (gdk_window, hint);
 
   g_object_notify (G_OBJECT (window), "type-hint");
 
@@ -6116,17 +6115,6 @@ gtk_window_map (GtkWidget *widget)
   priv->need_default_size = FALSE;
   priv->need_default_position = FALSE;
 
-  if (priv->reset_type_hint)
-    {
-      /* We should only reset the type hint when the application
-       * used gtk_window_set_type_hint() to change the hint.
-       * Some applications use X directly to change the properties;
-       * in that case, we shouldn't overwrite what they did.
-       */
-      gdk_window_set_type_hint (gdk_window, priv->type_hint);
-      priv->reset_type_hint = FALSE;
-    }
-
   gdk_window_show (gdk_window);
 
   if (!disable_startup_notification &&